package org.benben;

import java.util.logging.*;
import java.util.*;
import java.io.*;
import java.text.*;

public class Log 
{
    private String logFilePath = "";
    private String logFileName = "";
    private Logger log;
    
    public Log(String logFilePath, String logFileName)
    {
        this.logFilePath = logFilePath;
        this.logFileName = logFileName;
        log = Logger.getLogger(this.getClass().getName());
    }
    
    public Log()
    {
        System.out.println(this.getClass().getName());
        this.logFilePath = "/home/lixiao";
        this.logFileName = "a.log";
        log = Logger.getLogger(this.getClass().getName());
    }
    
    //public void setLogPath(S)
    //{
        
    //}
    
    public void setLogFile(String fileName)
    {
        
    }
    
    public void setLogPath(String pathName)
    {
        
    }
    
    public void setOutputFormat()
    {
        
    }
    
    public void setLogPath()
    {
        String logFile = this.logFilePath + this.logFileName;
        System.out.println(logFile);
        FileHandler fileHandler;
        try
        {
            fileHandler = new FileHandler(logFile, true);
         
            log.addHandler(fileHandler);
            
            fileHandler.setFormatter(new SimpleFormatter());
        }

        catch(SecurityException ex)
        {
            log.log(Level.SEVERE, "security error", ex);
        }
        catch(IOException ex)
        {
            log.log(Level.SEVERE, "file error", ex);
        }
    }
    
   
    public void output(String s)
    {
        log.log(Level.INFO, s);
    }
}

